<!DOCTYPE html>
<html><head>
	    <meta charset="utf-8">
    <title>shop</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="__ADMIN__/style/bootstrap.css" rel="stylesheet">
    <link href="__ADMIN__/style/font-awesome.css" rel="stylesheet">
    <link href="__ADMIN__/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="__ADMIN__/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="__ADMIN__/style/demo.css" rel="stylesheet">
    <link href="__ADMIN__/style/typicons.css" rel="stylesheet">
    <link href="__ADMIN__/style/animate.css" rel="stylesheet">

</head>
<body>
	<!-- 头部 -->
    {include file="common/top"}
	<!-- /头部 -->

	<div class="main-container container-fluid">
		<div class="page-container">
			 <!-- Page Sidebar -->
            {include file="common/left"}
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                                        <li>
                        <a href="{:url('Index/index')}">系统</a>
                    </li>
                                        <li class="active">商品库存管理</li>
                                        </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">


<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget">
            <div class="widget-body">
                <div class="flip-scroll">
                <form action="" method="post" accept-charset="utf-8">
                    <table class="table table-bordered table-hover">
                        <thead class="">
                            <tr>
                                {volist name="radioAttrRes" id="radio" }
                                <th class="text-center">{$key}</th>
                                {/volist}
                                <th class="text-center">库存量</th>
                                <th class="text-center" width="16%">操作</th>
                            </tr>
                        </thead>
                       <tbody>
                            <?php if($goodsProRes):
                                foreach($goodsProRes as $k0=>$v0):
                            ?>
                            <tr>
                                <?php foreach($radioAttrRes as $k=>$v):?>
                                <td align="center">
                                    <select name="goods_attr[{$k}][]">
                                        <option value="">请选择</option>
                                        <?php foreach($v as $k1=>$v1):
                                            $arr=explode(',', $v0['goods_attr']);
                                            if(in_array($v1['id'], $arr)){
                                                $select='selected="selected"';
                                            }else{
                                                $select='';
                                            }
                                        ?>
                                        <option <?php echo $select;?> value="<?php echo $v1['id'];?>"><?php echo $v1['attr_value'];?></option>
                                        <?php endforeach;?>
                                    </select>
                                </td>
                                <?php endforeach;?>
                                <td align="center"><input type="text" name="goods_num[]" style="text-align:center;" value="<?php echo $v0['goods_number'];?>"></td>
                                <td align="center"><a onclick="addrow(this);" class="btn btn-sm btn-azure btn-addon" href="javascript:;"><?php if($k0==0){ echo '+'; }else{ echo '-'; }?></a></td>
                            </tr>
                            <?php endforeach; else:?>
                            <tr>
                                <?php foreach($radioAttrRes as $k=>$v):?>
                                <td align="center">
                                    <select name="goods_attr[{$k}][]">
                                        <option value="">请选择</option>
                                        <?php foreach($v as $k1=>$v1):?>
                                        <option value="<?php echo $v1['id'];?>"><?php echo $v1['attr_value'];?></option>
                                        <?php endforeach;?>
                                    </select>
                                </td>
                                <?php endforeach;?>
                                <td align="center"><input type="text" name="goods_num[]" style="text-align:center;" value=""></td>
                                <td align="center"><a onclick="addrow(this);" class="btn btn-sm btn-azure btn-addon" href="javascript:;">+</a></td>
                            </tr>
                        <?php endif;?>
                        </tbody>
                    </table>
                    <div class="form-group" style="margin-top:15px; ;">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-blue">保存信息</button>
                        </div>
                  </div>
                  </form>
                </div>
                <div style="text-align:right;margin-top:10px; clear: both;">



                <div>
                	                </div>
            </div>
        </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
		</div>
	</div>

	    <!--Basic Scripts-->
    <script src="__ADMIN__/style/jquery_002.js"></script>
    <script src="__ADMIN__/style/bootstrap.js"></script>
    <script src="__ADMIN__/style/jquery.js"></script>
    <!--Beyond Scripts-->
    <script src="__ADMIN__/style/beyond.js"></script>
<script >

   function addrow(o){
        var div=$(o).parent().parent();
        if($(o).html() == '+'){
            var newdiv=div.clone();
            newdiv.find('a').html('-');
            div.after(newdiv);
        }else{
            div.remove();
        }
    }
</script>

</body></html>